package example1;

/**
 * <h3>designPattern</h3>
 * <p>代理对象:UserDaoProxy.java</p>
 * @author : zhang.bw
 * @date : 2021-02-27 14:27
 **/
public class UserDaoProxy implements IUserDao{

	//接收保存目标对象
	private IUserDao target;

	public UserDaoProxy(IUserDao target){
		this.target=target;
	}

	@Override
	public void save() {
		System.out.println("开始事务...");
		target.save();//执行目标对象的方法
		System.out.println("提交事务...");
	}
}
